﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace Terraria.ModLoader.IO
{
	// Token: 0x020002CC RID: 716
	public abstract class TagSerializer<T, S> : TagSerializer
	{
		// Token: 0x170001CC RID: 460
		// (get) Token: 0x06001BE7 RID: 7143 RVA: 0x00013FDB File Offset: 0x000121DB
		public override Type Type
		{
			get
			{
				return typeof(T);
			}
		}

		// Token: 0x170001CD RID: 461
		// (get) Token: 0x06001BE8 RID: 7144 RVA: 0x00013FE7 File Offset: 0x000121E7
		public override Type TagType
		{
			get
			{
				return typeof(S);
			}
		}

		// Token: 0x06001BE9 RID: 7145
		public abstract S Serialize(T value);

		// Token: 0x06001BEA RID: 7146
		public abstract T Deserialize(S tag);

		// Token: 0x06001BEB RID: 7147 RVA: 0x00013FF3 File Offset: 0x000121F3
		public override object Serialize(object value)
		{
			return this.Serialize((T)((object)value));
		}

		// Token: 0x06001BEC RID: 7148 RVA: 0x00014006 File Offset: 0x00012206
		public override object Deserialize(object tag)
		{
			return this.Deserialize((S)((object)tag));
		}

		// Token: 0x06001BED RID: 7149 RVA: 0x00014019 File Offset: 0x00012219
		public override IList SerializeList(IList value)
		{
			return ((IList<T>)value).Select(new Func<T, S>(this.Serialize)).ToList<S>();
		}

		// Token: 0x06001BEE RID: 7150 RVA: 0x00014038 File Offset: 0x00012238
		public override IList DeserializeList(IList value)
		{
			return ((IList<S>)value).Select(new Func<S, T>(this.Deserialize)).ToList<T>();
		}
	}
}
